Page({
  data: {
    value:"",
    classList:[]
  },
  goClassList(e){
    wx.navigateTo({url: '/pages/class/index?className='+e.currentTarget.dataset.classname+'&id='+e.currentTarget.dataset.id})
  },
  onLoad(){
    const vm = this;
    wx.getStorage({
      key: 'userInfo',
      success: function(res) {
        
      },
      fail(){
        wx.reLaunch({
          url: '/pages/login/index',
        })
        return;
      }
    })
    wx.getStorage({
      key:'userInfo',
      success:function(e){
        wx.request({
          url: 'https://www.bchzh.xin/hzmobilework/app/fileClassification/getClassification',
          data: {userId:e.data.id},
          header: {'content-type': 'application/json'},
          success(res) {
            vm.setData({classList: res.data.data.list})
          }
        })
      }
    })
  },
  onSearch(){
    if(this.data.value){
      wx.navigateTo({url: '/pages/search/index?key='+this.data.value})
    }else{
      wx.showToast({title:'关键字为空',icon:'none'})
    }
  },
  onChange(event){
    this.setData({
      value: event.detail
    });
  }
});